<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="base" uri="/WEB-INF/mytags.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<title>修改分类</title>
		<jsp:include page="../include.jsp" />
		<c:set var="local" value="${pageContext.request.contextPath}/service/channelAction" scope="request"/>
		<link href="${local}/resource/css/zTreeStyle.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="${local}/resource/js/jquery.ztree.core-3.0.min.js"></script>
		<script type="text/javascript">
		 	var urlParam="../channel/tree.do";
		</script>
		<script type="text/javascript" src="${local}/resource/js/tree.js"></script>
		<style type="text/css">
		ul.ztree {
			background: none repeat scroll 0 0 #F0F6E4;
			border: 1px solid #617775;
			height: 360px;
			margin-top: 10px;
			overflow-x: auto;
			overflow-y: scroll;
			width: 220px;
		}
		
		div.zTreeDemoBackground {
			text-align: left;
		}
		</style>
		<script>
		$(document).ready(function() {
			var v="${base:getMapValue(attrs,'channel_name')}";
			if(v!=null){
				var cityObj = $("#citySel");
				cityObj.attr("value", v);
			}
		});
		</script>
	</head>
	<body class="input goods">
		<div class="bar">添加分类 <input type="button"
			class="formButton" onclick="window.history.back(); return false;"
			value="返  回" hidefocus style="float: right; margin-right: 10px"/></div>
		<div id="validateErrorContainer" class="validateErrorContainer">
		<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
		<%@ include file="../common/image_upload.html"%>
		</div>
		<div class="body">
		<form id="validateForm" class="form" action="update.do" method="post">
		<input type="hidden" name="site_id" value="${site_id}"/>
		<input type="hidden" name="has_content" value="${has_content}"/>
		<input type="hidden" name="model_id" value="${model_id}"/>
		<input type="hidden" name="channel_id" value="${base:getMapValue(attrs,'channel_id')}"/>
		<input type="hidden" name="parent_id" value="${base:getMapValue(attrs,'parent_id')}"/>
			<table class="inputTable tabContent">
				<tr>
					<th>栏目</th>
					<td>
						<div class="content_wrap">
							<div class="zTreeDemoBackground left">
										<input id="citySel"
									type="text" readonly value="" style="width: 120px;"	onclick="showMenu();"/>
							</div>
						</div>
						<div id="menuContent" class="menuContent" style="display: none; position: absolute;">
							<ul id="treeDemo" class="ztree"	style="margin-top: 0; width: 180px; height: 300px;"></ul>
						</div>
					</td>
					<th>模型</th>
					<td>${model_name}</td>
				</tr>
				<c:forEach items="${list}" var="bos">
					<tr>
						<c:forEach items="${bos}" var="item">
							<c:if test="${item.data_type==1||item.data_type==2||item.data_type==3}">
								<base:text name="${item.field}" 
									value="${base:getMapValue(attrs,item.field)}" 
									size="${item.text_size}" label="${item.item_label}" single="${fn:length(bos)}"
									help="${item.help_content}" required="${item.is_required}"/>
							</c:if>
							<c:if test="${item.data_type==4}">
								<base:textarea name="${item.field}" 
									value="${base:getMapValue(attrs,item.field)}"
									size="${item.text_size}" label="${item.item_label}" single="${fn:length(bos)}"
									help="${item.help_content}" required="${item.is_required}"/>
							</c:if>
							<c:if test="${item.data_type==5}">
								<base:datetime name="${item.field}" 
									size="${item.text_size}" label="${item.item_label}" 
									single="${fn:length(bos)}" help="${item.help_content}" required="${item.is_required}"
									value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==6}">
								<base:select name="${item.field}" 
									value="${base:getMapValue(attrs,item.field)}"
									label="${item.item_label}" list="${item.opt_value}" single="${fn:length(bos)}"
									help="${item.help_content}" required="${item.is_required}"/>
							</c:if>
							<c:if test="${item.data_type==7}">
								<base:checkbox name="${item.field}" label="${item.item_label}"
									 list="${item.opt_value}" single="${fn:length(bos)}" 
									 help="${item.help_content}" required="${item.is_required}"
									 value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==8}">
								<c:set value="${base:getMapValue(attrs,item.field)?1:0}" var="value"/>
								<base:radio name="${item.field}" value="${value}" 
									label="${item.item_label}" list="${item.opt_value}"
									single="${fn:length(bos)}" help="${item.help_content}" 
									required="${item.is_required}"/>
							</c:if>
							<c:if test="${item.data_type==9}">
								<base:colorpacker name="${item.field}" label="${item.item_label}" 
									single="${fn:length(bos)}" help="${item.help_content}" 
									required="${item.is_required}"
									value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==10}">
								<base:attachment name="${item.field}" label="${item.item_label}" 
									single="${fn:length(bos)}" help="${item.help_content}"
									required="${item.is_required}"
									value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==11}">
								<base:template name="${item.field}" label="${item.item_label}" 
									list="${item.opt_value}" single="${fn:length(bos)}" 
									help="${item.help_content}" required="${item.is_required}"
									value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==12}">
								<base:editor name="${item.field}" label="${item.item_label}" 
									single="${fn:length(bos)}" help="${item.help_content}" 
									required="${item.is_required}"
									value="${base:getMapValue(attrs,item.field)}"/>
							</c:if>
							<c:if test="${item.data_type==13}">
								<base:picture name="${item.field}" label="${item.item_label}" 
									value="attrs" single="${fn:length(bos)}" 
									help="${item.help_content}" required="${item.is_required}"/>
							</c:if>
						</c:forEach>
					</tr>
				</c:forEach>
			</table>
			<div class="buttonArea"><input type="submit" class="formButton"
			value="确  定" hidefocus /></div>
		</form>
		</div>
	</body>
</html>